package com.woniu.controller;

import com.woniu.entity.News;
import com.woniu.entity.NewsVO;
import com.woniu.service.NewsService;
import com.woniu.util.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/news")
public class NewsController {
    @Resource
    private NewsService newsService;
    @PostMapping
    public ResponseUtil add(@RequestBody NewsVO news){
        ResponseUtil result = newsService.addNews(news);
        return result;
    }
    @GetMapping
    public ResponseUtil queryNews(){
        ResponseUtil result = newsService.queryNews();
        return result;
    }
    @PutMapping
    public ResponseUtil addVolume(@RequestBody News news){
        ResponseUtil result = newsService.addVolume(news);
        return result;
    }
}
